package com.example.smartcitydemo.network.interceptor

import com.example.smartcitydemo.AUTHORITY
import com.example.smartcitydemo.MyApplication
import okhttp3.Interceptor
import okhttp3.Response

/**
 * @PACKAGE_NAME: com.example.smartcitydemo.network.interceptor
 * @NAME: Caleb.F
 * @DATE: 2021/11/3 10:28
 * @Email: 1919796283@qq.com
 */
object HeadInterceptor : Interceptor {
    override fun intercept(chain: Interceptor.Chain): Response {
        val request = chain.request()
        val newRequest = request.newBuilder().addHeader(AUTHORITY, MyApplication.sp.getString(
            AUTHORITY,"")!!).build()
        return chain.proceed(newRequest)
    }
}
